package forcadistribuido;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import forcadistribuido.remoteServerInterface.IForcaRemota;
import forcadistribuido.*;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;

/**
 *
 * @author matheus
 */
public class InitForcaRemota {

    private static String ENDERECO = "rmi://localhost/Forca";

    public static void main(String[] args) {
        try {

            ForcaRemota forca = new ForcaRemota();

            IForcaRemota stub =  (IForcaRemota) UnicastRemoteObject.exportObject(forca, 0);

            LocateRegistry.createRegistry(Registry.REGISTRY_PORT);//FDP

            Registry registry = LocateRegistry.getRegistry();

            registry.rebind(ENDERECO, stub);
            
            System.out.println("Server on line");
        } catch (Exception e) {
            System.err.println("Babou");
            e.printStackTrace();
        }
    }
}
